load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary")
load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest")

oncall("scm_client_infra")

cpp_unittest(
    name = "test",
    srcs = [
        "PrivHelperTest.cpp",
        "PrivHelperTestServer.cpp",
    ],
    headers = ["PrivHelperTestServer.h"],
    compatible_with = [
        "ovr_config//os:linux",
        "ovr_config//os:macos",
    ],
    deps = [
        "fbsource//third-party/googletest:gmock",
        "fbsource//third-party/googletest:gtest",
        "//eden/common/testharness:temp_file",
        "//eden/common/utils:system_error",
        "//eden/common/utils:user_info",
        "//eden/fs/privhelper:conn",
        "//eden/fs/privhelper:interface",
        "//eden/fs/privhelper:privhelper",
        "//eden/fs/privhelper:server",
        "//folly:conv",
        "//folly:exception",
        "//folly:file",
        "//folly:file_util",
        "//folly:range",
        "//folly/futures:core",
        "//folly/io/async:async_base",
        "//folly/io/async:event_base_thread",
        "//folly/test:test_utils",
        "//folly/testing:test_util",
    ],
    external_deps = [
        ("boost", None, "boost_filesystem"),
    ],
)

cpp_binary(
    name = "drop_privs",
    srcs = ["DropPrivs.cpp"],
    compatible_with = [
        "ovr_config//os:linux",
        "ovr_config//os:macos",
    ],
    deps = [
        "//eden/common/utils:user_info",
        "//folly/init:init",
        "//folly/logging:init",
        "//folly/logging:logging",
        "//folly/portability:unistd",
    ],
)
